<table class="list">
<tr class="foot">
	<td colspan=5>
		<input type="button" value="返回分类" onclick="location.href='<?php echo url('cate'); ?>'" />
		<input type="button" value="新建交集" onclick="location.href='<?php echo url('mix-add'); ?>'" /> &nbsp;
		搜索：<?php echo Html::options($cates, array('text_key'=>'title','tips'=>'----','id'=>'rid',
						'val'=>fetch_get('rid'), 'ext'=>'onchange="so()"')); ?>
	</td>
</tr>
<tr class="head">
	<th>分类一</th>
	<th>分类二</th>
	<th>类型</th>
	<th>交集分类</th>
	<th>----</th>
</tr>
<?php foreach($list as $mix): 
		$id	= "{$mix['_pid1']},{$mix['_pid2']}";
	?>
<tr class="body" id="{$id}">
	<td><?php
		//if($mix['pid1']):
		foreach($mix['pid1'] as $rs):
			echo '>', $rs['title'];
		endforeach;
		echo "{{$rs['hid']}}";
		//endif;
		?></td>
	<td><?php
		if($mix['pid2']):
		foreach($mix['pid2'] as $rs):
			echo '>', $rs['title'];
		endforeach;
		echo "{{$rs['hid']}}";
		endif;
		?></td>
	<td><?php echo $mix['type']?'Selected':'Whole' ?></td>
	<td><?php
		foreach($mix['hid'] as $rs):
			echo '>', $rs['title'];
		endforeach;
		echo "{{$rs['hid']}}";
		if($mix['value']):
			echo ':', Html::options($mix['value'],array('text_key'=>'title','id'=>'a'));
		endif;
		?></td>
	<td>
		<a href="javascript:;<?php //echo url(array('a'=>'mix-mod','pid'=>$id)) ?>">修改</a>
		<a href='javascript:del(<?php echo "\"$id\"" ?>)'>删除</a>
	</td>
</tr>
<?php endforeach ?>
</table>

<script>
function del(pid)
{
	if(confirm('really delete it?')){
		$.get("<?php echo url(array('a'=>'mix-del','pid'=>'PID')) ?>".replace('PID',pid), function(data){
			alert(data.message);
			if(data.level=='notice'){
				location.reload();
			}
		});
	}
}
function so()
{
	location.href='<?php echo url(array('rid'=>'RID')) ?>'.replace('RID',$('#rid').val());
}
</script>
